package com.kingyun.gpsinspection.purificationservice.facade.service.jsm.device;

import com.kingyun.gpsinspection.purificationservice.facade.model.jsm.*;
import org.springframework.beans.factory.parsing.Problem;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
import java.util.Map;

/**
 * @version V1.0
 * @Description: ${TODO}(生产设备服务层)
 * @author: YuPeng
 * @date: 2016/12/2,15:53
 */
public interface JsmDeviceService {
    /**
     * 以下是设备逻辑处理方法
     */
    List<DeviceVo> getDevices(String orgId) throws Exception;

    /**
     * 添加设备 , 新增设备所涉及的相关表查询
     * 区域维护信息表
     * 设备特性值 ，设备类型特性值 ， 设备类型参数 ， 设备类型参数值 ， 组织机构 ，
     *
     * 1：新增设备 2：设备信息保存到实体表 ：3保存特性值到实体类型值表
     */
    Map<String, Object> addDevice(Device device, EmployeeVo employee) throws Exception;

    /**
     * 删除设备
     * @param id
     * @throws Exception
     */
    Map<String, Object> delDeviceById(String id) throws Exception;

    /**
     * 批量删除设备
     * @param id
     */
    Map<String, Object> delDeviceById(String[] id) throws Exception;

    /**
     * 修改设备信息
     *
     * @param device
     * @return
     * @throws Exception
     */
    Map<String, Object> modifyDevice(Device device, EmployeeVo employee) throws Exception;

    /**
     * 获取设备详情
     *
     * @param id
     * @return
     * @throws Exception
     */
    DeviceVo getDeviceById(String id) throws Exception;

    /**
     * 设备列表分页展示
     *
     * @param deviceVO
     * @return
     * @throws Exception
     */
    Map<String, Object> searchDevices(DeviceVo deviceVO) throws Exception;

    /*
----------------------以下是设备特性逻辑处理方法---------------------------------------------
     */

    /**
     * 添加设备特性
     *
     * @param entityPro
     * @return
     * @throws Exception
     */
    Map<String, Object> addDevicePro(EntityPro entityPro, EmployeeVo employee) throws Exception;

    /**
     * 获取设备特性分页列表
     *
     * @param device
     * @return
     * @throws Exception
     */
    Map<String, Object> getDevicePro(Device device) throws Exception;

    /**
     * 克隆生产实体类型的特性到实体中去
     * @param entityId
     * @throws Exception
     */
    Map<String, Object> clonePro(String entityId, EmployeeVo employee) throws Exception;




    /**
     * 修改设备特性
     *
     * @param entityPro
     * @return
     * @throws Exception
     */
    Map<String, Object> modifyDevicePro(EntityPro entityPro, EmployeeVo employee) throws Exception;

    /**
     * 批量删除设备特性
     *
     * @param deviceProIds
     * @return
     * @throws Exception
     */
    Map<String, Object> delDeviceProById(String[] deviceProIds) throws Exception;

    /**
     * 单个删除设备特性
     *
     * @param deviceProIds
     * @return
     * @throws Exception
     */
    Map<String, Object> delDeviceProById(String deviceProIds) throws Exception;

    /**
     * Excel导入设备特性
     *
     * @param excel
     * @param deviceId
     * @return
     * @throws Exception
     */
    Map<String, Object> importDevicePro(MultipartFile excel, String deviceId, EmployeeVo employee) throws Exception;
    /*
--------------- 以下是设备阈值逻辑处理方法------------------------------
     */

    /**
     * 获取设备阈值分页列表
     *
     * @param deviceThreshold
     * @return
     * @throws Exception
     */
    Map<String, Object> getDeviceThres(DeviceThreshold deviceThreshold) throws Exception;

    /**
     * 添加设备阈值
     *
     * @param deviceThreshold
     * @return
     * @throws Exception
     */
    Map<String, Object> addDeviceThres(DeviceThreshold deviceThreshold, EmployeeVo employee) throws Exception;

    /**
     * 修改设备阈值
     *
     * @param deviceThreshold
     * @return
     * @throws Exception
     */
    Map<String, Object> modifyDeviceThres(DeviceThreshold deviceThreshold, EmployeeVo employee) throws Exception;

    /**
     * EXCEL导入设备阈值
     *
     * @param excel
     * @param deviceId
     * @return
     * @throws Exception
     */
    Map<String, Object> importDeviceThres(MultipartFile excel, String deviceId, EmployeeVo employee) throws Exception;

    /**
     * EXCEL导入生产实体阈值
     *
     * @param excel
     * @param entityId
     * @return
     * @throws Exception
     */
    Map<String, Object> importEntityThres(MultipartFile excel, String entityId, EmployeeVo employee) throws Exception;

    /**
     * 按ID删除设备阈值
     *
     * @param etId
     * @return
     * @throws Exception
     */
    Map<String, Object> delDeviceThresById(String etId) throws Exception;

    /**
     * 批量删除设备阈值
     *
     * @param etIds
     * @return
     * @throws Exception
     */
    Map<String, Object> delDeviceThresById(String[] etIds) throws Exception;

    /**
     * 批量修改作业区同步设备
     *
     * @param orgId
     * @param enTypeId
     * @param deviceIds
     * @return
     * @throws Exception
     */
    Map<String, Object> modifySycnDevice(String orgId, String enTypeId, String[] deviceIds, EmployeeVo employee) throws Exception;

    /**
     * 得到设备
     * @param id
     * @return
     */
    Device getDeviceByDeviceId(String id);

    /**
     * 导入设备信息和设备的拓展信息
     * @param device
     * @param deviceExpand
     * @return
     */
    int importDevice(Device device, DeviceExpand deviceExpand, EmployeeVo employee);


    /**
     * 获取设备树
     * @param isOrg  判断是否为组织
     * @param orgId
     * @throws Exception
     */
    List<Ztree> getDeviceTree(String isOrg, String orgId, Employee employee) throws Exception;

    /**
     * 改变设备运行状态
     * @param deviceId
     * @param state
     * @return
     * @throws Exception
     */
    Map<String,Object> changeState(String deviceId, Integer state) throws Exception;


    /**
     * 得到设备对应的隐患
     * @param problem
     * @return
     */
    Map<String,Object> findProblemOfDeviceByPage(Problem problem);

    /**
     * 计算维护保养时间
     * @param device
     * @return
     */
    int CycleCalculation(Device device)throws Exception;


    /**
     * @param  clientDatas
     * @return 客户端封装数据类型
     * @throws Exception
     */
    List<DeviceDataModel> getHttpServiceDatasByOpcs(List<DeviceDataModel> clientDatas) throws Exception ;


    /**
     * 得到设备对应的工单
     * @param manageWorkOrderVo
     * @return
     */
    Map<String,Object> getWorkOrder(ManageWorkOrderVo manageWorkOrderVo);

    /**
     * @param  organizationList 当前人所有的组织机构 不包含部门
     * @param  keyword 模糊搜索问题
     */
    List<DeviceVo> queryDeviceVoByOrgsKeyword(List<Organization> organizationList,String keyword) throws Exception ;
}
